#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
@UserFor     :   ***    ***
@File        :   py_pic.py    
@Email       :   18574945291@163.com
@Modify Time :   2021-02-19 10:34
@Author      :   code_wizard (wll) 
"""

# from pyecharts.charts import Bar
# from pyecharts import options as opts
# from pyecharts.globals import ThemeType
# import pyecharts
# print(pyecharts.__version__)
# bar = (
#     Bar(init_opts=opts.InitOpts(theme=ThemeType.LIGHT))
#     .add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
#     .add_yaxis("商家A", [5, 20, 36, 10, 75, 90])
#     .add_yaxis("商家B", [15, 6, 45, 20, 35, 66])
#     .set_global_opts(title_opts=opts.TitleOpts(title="主标题", subtitle="副标题"))
# )
# # render 会生成本地 HTML 文件，默认会在当前目录生成 render.html 文件
# # 也可以传入路径参数，如 bar.render("mycharts.html")
# bar.render()


from pyecharts import options as opts
from pyecharts.charts import Kline
import csv

data = []
te = []

with open("399300.csv","r") as f:
    reader = csv.reader(f)
    for i,j in enumerate(reader):
        print(i,j)
        temp = []
        temp.append(j[6])
        temp.append(j[3])
        temp.append(j[5])
        temp.append(j[4])
        data.append(temp)
        te.append(j[0])

c = (
    Kline()
    .add_xaxis(te[::-1])
    .add_yaxis("kline", data[::-1])
    # .set_global_opts(
    #     xaxis_opts=opts.AxisOpts(is_scale=True),
    #     yaxis_opts=opts.AxisOpts(
    #         is_scale=True,
    #         splitarea_opts=opts.SplitAreaOpts(
    #             is_show=True, areastyle_opts=opts.AreaStyleOpts(opacity=1)
    #         ),
    #     ),
    #     title_opts=opts.TitleOpts(title="Kline-显示分割区域"),
    # )
    .render("kline_split_area.html")
)